#pragma once

namespace System
{

/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL    0
#else
#define NULL    ((void *)0)
#endif
#endif


#ifndef _TCHAR_DEFINED
#ifdef UNICODE
typedef wchar_t TCHAR;
#else
typedef char TCHAR;
#endif
#define _TCHAR_DEFINED
#endif

/*******************************************************/
#if !PTSTR
typedef TCHAR* PTSTR;
#endif

#if !PPTSTR
typedef TCHAR** PPTSTR;
#endif

/*******************************************************/
#ifndef __T
#define __T(x)      L ## x
#endif

#ifndef _T
#define _T(x)       __T(x)
#endif

#ifndef _TEXT
#define _TEXT(x)    __T(x)
#endif


#ifndef PPTSTR_SKIP
#define PPTSTR_SKIP(pptstr, len) *pptstr = &(*pptstr + len)[0]
#endif


/*******************************************************/
#ifndef DEFINE_CLASS_TYPE
#define DEFINE_CLASS_TYPE(type, name) static const Type global_static_const_##type##_Object(##name##)
#endif

#ifndef TYPE_OF
#define TYPE_OF(type) &global_static_const_##type##_Object
#endif

#ifndef N_TYPE_OF
#define N_TYPE_OF(namesapce, type) &namesapce##::global_static_const_##type##_Object
#endif


#ifndef VIRTUAL_GET_TYPE
#define VIRTUAL_GET_TYPE() virtual const Type* GetType() const
#endif

#ifndef VIRTUAL_TOSTRING
#define VIRTUAL_TOSTRING() virtual const TCHAR* ToString() const
#endif

#ifndef VIRTUAL_GET_TYPE_IMPLEMENT
#define VIRTUAL_GET_TYPE_IMPLEMENT(type, name) const Type* ##type##::GetType() const { \
	return TYPE_OF(##name##); }
#endif

#ifndef VIRTUAL_TOSTRING_IMPLEMENT
#define VIRTUAL_TOSTRING_IMPLEMENT(type, name) const TCHAR* ##type##::ToString() const { \
	return (TYPE_OF(##name##))->GetFullName(); }
#endif

/*******************************************************/


}// end namespace